package xiti;

/**
 * Created by mc on 2016/7/25.
 */
import java .util.*;
public class shisi
{
    public static void main(String[] arge)
    {
        int a[]={1,10,31,33,37,48,60,70,80};
        int c;
        int b;
        Scanner reader = new Scanner(System.in);
        b=reader.nextInt();
        for(c=0;c<9;c=c+1)
        {
            if(a[c]==b)
            {
                System.out.println(reader);
                break;
            }
        }
        if(b!=a[0]&&b!=a[1]&&b!=a[2]&&b!=a[3]&&b!=a[4]&&b!=a[5]&&b!=a[6]&&b!=a[7]&&b!=a[8])
            System.out.printf("-1");

    }
}
